<template>
	<view class="image-card" @click="routeTo">
		<image :src="data[urlLabel]" mode="aspectFill"></image>
		<text>{{data[label]}}</text>
	</view>
</template>

<script>
	export default {
		props:{
			data:{
				type:Object,
				default:{}
			},
			label:{
				type:String,
				default:'title'
			},
			urlLabel:{
				type:String,
				default:'picture'
			}
		},
		data() {
			return {
				
			}
		},
		methods: {
			routeTo() {
				this.$emit('routeTo',this.data)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.image-card{
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 330rpx;
		height: 314rpx;
		border-radius: 20rpx;
		background-color: #fff;
		box-shadow:0rpx 0rpx 15rpx 0rpx rgba(0, 0, 0, 0.1);
		image{
			width: 330rpx;
			height: 246rpx;
			border-radius: 20rpx;
			margin-bottom:20rpx;
            
		}
		text{
			text-align: center;
			font-size: 28rpx;
			width: 100%;
			padding: 0 20rpx;
			overflow: hidden;
			white-space: nowrap;
			box-sizing: border-box;
			text-overflow: ellipsis;
		}
	}
</style>
